{extend name="public/base" /}
{block name="style"}<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" /> {/block}
 {block name="body"}
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-title">
				<h5>绑定提现帐户</h5>
			</div>
			<div class="ibox-content">
				<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('add')}">	
					<div class="form-group">
						<label class="col-sm-3 control-label">绑定类型：</label>
						<div class="input-group col-sm-4">
						<input type="radio" name="type" value="1" checked=""/> 银行卡
						<input type="radio" name="type" value="2" /> 支付宝		
						<input type="radio" name="type" value="3" /> 微信
						</div>
						<label class="control-label">要绑定的提现账户类型</label>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">验证码：</label>
						<div class="col-sm-4 input-group">
                            <div class="input-group">
                                <input type="text" placeholder="请输入短信验证码" class="input-sm form-control"> <span class="input-group-btn">
                                    <button type="button" class="btn btn-sm btn-primary"> 获取验证码</button> </span>
                            </div>
                        </div>
					</div>
					<div class="form-group bank" >
						<label class="col-sm-3 control-label">开户行：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="bank_account" name="bank_account"  class="form-control" />
						</div>
					</div>
					<div class="form-group bank" >
						<label class="col-sm-3 control-label">开户人：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="bank_username" name="bank_username"  class="form-control" />
						</div>
					</div>
					<div class="form-group bank" >
						<label class="col-sm-3 control-label">银行卡号：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="card_no" name="card_no"  class="form-control" />
						</div>
					</div>
					<div class="form-group alipay" style="display:none;">
						<label class="col-sm-3 control-label">支付宝昵称：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="alipay_nickname" name="alipay_nickname"  class="form-control" />
						</div>
					</div>
					<div class="form-group alipay" style="display:none;">
						<label class="col-sm-3 control-label">支付宝号：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="alipay" name="alipay"  class="form-control" />
						</div>
					</div>
					<div class="form-group wechat" style="display:none;">
						<label class="col-sm-3 control-label">微信昵称：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="wechat_nickname" name="wechat_nickname"  class="form-control" />
						</div>
					</div>
					<div class="form-group wechat" style="display:none;">
						<label class="col-sm-3 control-label">微信号：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="wechat_account" name="wechat_account"  class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-3">
							<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
							<a href="{:url('index')}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__LIB__/datepicker/WdatePicker.js"></script>
<script>
	upload_one('__IMG__/default.jpg');
	$("input[name='type']").click(function(){
		var value = $(this).val();
		if(value == '1'){
			$(".alipay").hide();
			$(".wechat").hide();
			$(".bank").show();
		}else if(value == '2'){
			$(".alipay").show();
			$(".wechat").hide();
			$(".bank").hide();
		}else if(value == '3'){
			$(".alipay").hide();
			$(".wechat").show();
			$(".bank").hide();
		}
	})
	
	$(function() {
		var value = $("input[name='type']:checked").val();	
		if(value == '1'){
		$("#myForm").validate({
			rules: {				
				bank_account: "required",
				bank_username:"required",
				card_no:"required"
			},
			messages: {
				bank_account: ICON.error + "请输入开户行",
				bank_username:ICON.error + "请输入开户人",
				card_no:ICON.error + "请输入银行卡号"
			},
			submitHandler: function(form) {
				ajaxForm();
			}
		});
		}
	});
</script>
{/block}